package com.springsource.listadopersonas.domain;

import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.springframework.format.annotation.DateTimeFormat;
import com.springsource.listadopersonas.reference.Region;
import javax.persistence.Enumerated;
import java.util.Set;
import com.springsource.listadopersonas.domain.Hijo;
import java.util.HashSet;
import javax.persistence.ManyToMany;
import javax.persistence.CascadeType;

@RooJavaBean
@RooToString
@RooEntity
public class Persona {

    @NotNull
    @Size(min = 3, max = 30)
    private String Nombres;

    @NotNull
    @Size(min = 3, max = 30)
    private String Apellidos;

    @NotNull
    @Size(min = 5, max = 11)
    private String Rut;

    @NotNull
    @Size(min = 5, max = 30)
    private String Direccion;

    @NotNull
    @Size(min = 5, max = 20)
    private String Comuna;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date FechaNacimiento;

    @NotNull
    @Enumerated
    private Region Region;

    @NotNull
    private Boolean Tecnologia;

    @NotNull
    private Boolean Deportes;

    @NotNull
    private Boolean Musica;

    @NotNull
    private Boolean Cine;

    @NotNull
    private Boolean Arte;

    @NotNull
    private Boolean Pintura;

    @ManyToMany(cascade = CascadeType.ALL, mappedBy = "padre")
    private Set<Hijo> hijos = new HashSet<Hijo>();
}
